package test.com.ampaiva.pattern.observer;

import com.ampaiva.pattern.observer.ObserverPattern;

public aspect TemperatureObservation extends ObserverPattern {
    declare parents: Temperature implements Subject;
    declare parents: Thermometer implements Observer;

    public pointcut subjectChange(Subject s): target(s) &&
    execution(void Temperature.setValue(double));

    public void updateObs(Subject s, Observer o) {
        Temperature temp = (Temperature) s;
        Thermometer term = (Thermometer) o;
        term.printTemperature(temp.getValue());
    }
}
